//
//  SDFormBaseData.h
//  SKinDiary
//
//  Created by pcyang on 16/7/11.
//  Copyright © 2016年 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>

@class SDFormBaseData;


@protocol SDFormBaseDataDelegate <NSObject>
-(void) willUploadOfFormData:(SDFormBaseData*) formdata;
-(void) formData:(SDFormBaseData*)formdata userInfo:(NSDictionary*) userInfo didFinishLoadWithError:(NSError*)error;
@end

@interface SDFormBaseData : NSObject
@property(nonatomic,weak) id<SDFormBaseDataDelegate> delegate;

#pragma mark ---
#pragma mark out call

-(void)uploadFormDataWithUserInfo:(NSDictionary*) userInfo;
-(id) getFilePartInfoWithFileUrl:(NSURL*) fileUrl partName:(NSString*) partName fileName:(NSString*) fileName mimeType:(NSString*) mimeType;

- (BOOL)isLoading;
- (void)clear;
- (void)clearDelegatesAndCancel;

- (void)refreshDataDidFinishWithUserInfo:(NSDictionary*) userInfo error:(NSError*)error;

#pragma mark ---
#pragma mark over cover
-(NSString*)getHTTPMethod;
-(NSString*)getFullURL;
-(NSDictionary*)getPostDictionary;
-(NSDictionary*)requestCookies;

+(id)realJosnDataFromResponseData:(id)data err:(NSError**)error;
+(id)modelFromResponseValues:(id)infos error:(NSError**)error;

-(id)resetWithResponseModel:(id)data;

-(void)excuteHttpRequest;
@end
